<%@ page contentType="text/html; charset=utf-8" language="java" import="java.sql.*;import java.lang.*;import java.util.Vector;import com.Post;import com.School_information;import com.GetSchool;import com.GetPost" errorPage="" %>
<!DOCTYPE html PUBLIC "-//W3C//DTD XHTML 1.0 Transitional//EN" "http://www.w3.org/TR/xhtml1/DTD/xhtml1-transitional.dtd">
<html xmlns="http://www.w3.org/1999/xhtml">
<head>
<meta http-equiv="Content-Type" content="text/html; charset=utf-8" />
<title>登陆界面</title>
<link rel="stylesheet" type="text/css" href="css1.css"/>
<style type="text/css">
#div_serch{
width:inherit;
height:inherit;
position:absolute;
background:#ff0000;
left:800px;
opacity:0.6;
filter:alpha(opacity:60);
display:none;
}
</style>
<script type="text/javascript">
window.onload=function()
{
   var hea = document.getElementById("body_sch");
   hea.onmouseover = function()
   {
	   document.getElementById("div_serch").style.display = 'block';
   }
   hea.onmouseout = function()
   {
	   document.getElementById("div_serch").style.display = 'none';
   }
}
function getSchool_S(ID){
	var xmlHttp;
	var str=document.getElementById(ID).value.trim();
	if(str.length==0)
	{
		document.getElementById("school_content").innerHTML="<font color='#FFFFFF'><b>您的学校名字不能为空</b></font>";
		return false;
	}
	if(window.XMLHttpRequest){
		xmlHttp=new XMLHttpRequest();
		
	}else{  
		xmlHttp=new ActiveXObject("Microsoft.XMLHTTP");
    }
	
	xmlHttp.onreadystatechange=function(){//服务器相应
		if (xmlHttp.readyState==4 && xmlHttp.status==200){
    		document.getElementById("school_content").innerHTML=xmlHttp.responseText;
   	 	}
  	}
	xmlHttp.open("get","/xiaonei1227/getSchoolname.jsp?ID="+encodeURI(encodeURI(str)),true);
    xmlHttp.send(null);    
	return true;
}

</script>
</head>

<body>

<div id="head">
   <%
     request.setCharacterEncoding("utf-8");
     response.setCharacterEncoding("utf-8");
     String Login = (String)session.getAttribute("Login");
     Vector<School_information> vSchool =  (Vector<School_information>)session.getAttribute("school_information");
     Vector<Post> vPost =  (Vector<Post>)session.getAttribute("Post");	 
	 String NoHavePeople = (String)session.getAttribute("NoHavePeople");
	 String begin = (String)request.getParameter("begin");
	 if(begin==null)
	 begin="0";
     int be = Integer.parseInt(begin);
	 if(be<0)
	 be=0;
	 if(vSchool==null)
	 {
	    GetSchool gS = new GetSchool();
		vSchool = gS.getVSchool();
		session.setAttribute("school_information",vSchool);
	 }
	 if(vPost==null)
	 {
	    GetPost gp = new GetPost();
	    vPost = gp.getPost();
		session.setAttribute("Post",vPost);
	 }
     if(Login==null||!Login.equals("Yes")){%>
   <div id="xiaonei">
      <img src="images_zs/schooln.png"/>
   </div>
   <div id="login">
      <form action="/xiaonei1227/loginto">
	     <font face="宋体" size="5pc">帐号:</font><input type="text" class="text1" name="user"/><%if(NoHavePeople!=null&&NoHavePeople.equals("1")){%><font color="#FF0000">您没有注册</font><%}%><br/>
         <font face="宋体" size="5pc">密码:</font><input type="password" class="text1" name="password"/><br/>
		 <input type="submit" value="登陆" class="btn_s"/><a  href="register.html"  class="a_1">注册</a>
	  </form>
   </div>
   <%}else{%>
   <br/>
   <script>document.getElementById('head').style.height='50px';</script>
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;校内&nbsp;&nbsp;&nbsp;与朋友分享
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<a href="/xiaonei1227/homepage2.jsp"><%=(String)session.getAttribute("nickname")%></a>
   &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;
   <a href="/xiaonei1227/killsession" style="text-decoration:none"><font face="宋体" color="#000000">退出</font></a>
   <br />
   <%}%>
</div>
<div class='bo' id="body_sch"><center>
<div id="div_serch">
<input type="text" id="school_name1"/><input type="button" value="搜索吧" onclick="getSchool_S('school_name1')"/>
<a href="R1.jsp">全局搜索</a><br/>
<span id="school_content"></span>
</div>
<div class='school'>
<div  class="school4"><div class="img_zuo"><a href=<%="dl.jsp?begin="+(be-6)%> ><img id='img_zuo'src="images_zs/zuo.png" onmouseover="img_zuo.src='images_zs/zuo1.png'" onmouseout="img_zuo.src='images_zs/zuo.png'"/></a></div></div>
<div class="school3">
    <%if(vSchool!=null){
	      if(be>=vSchool.size())
	      {  
	    	  be-=6;
	      }
	      if(be<0) be=0;	       
	   for(int i=be;vSchool!=null&&i<be+6&&i<vSchool.size();i++){
	      School_information str=(School_information)vSchool.get(i);
	      if(str!=null)%>
    <div class="school1">
      <div class="school_img">
	      <img  src=<%="images_zs/"+str.getSchool_id()+".jpg"%> width="120px" height="120px"/>
	  </div>
	     <br /><br /><label><font size="2">关注量:<%=str.getFocus()%></font></label>
		 <br /><br /><label ><font size="2">帖子数:<%=str.getPost_num()%></font></label>
		 <br /><br /><label ><font size="2">学子数:<%=str.getStudent_num()%></font></label>
		 <br /><br /><a href="which-uni.jsp?num=<%=str.getSchool_id()%>&iPage=1"><font face="新宋体" size="5pc"><%=str.getName()%>吧</font></a>
	</div>
	<%}
	   if(be==vSchool.size()-6)
	     be-=6;
	}%>
</div>
<div class="school4"><div class="img_you"><a href=<%="dl.jsp?begin="+(be+6)%>><img id='img_you'src='images_zs/you.png' onmouseover="img_you.src='images_zs/you1.png'" onmouseout="img_you.src='images_zs/you.png'" /></a></div></div>
<center><a href="#" ><font color="#FF0000">MORE...</font></a></center>
</div>
<div class='tie'>
   <a href="/xiaonei1227/School.jsp" ><font size="5pc" color="#000000">热门动态</font></a>&nbsp;&nbsp;&nbsp;&nbsp;<%if(!(Login==null)&&Login.equals("Yes")){%><a href="Char_con.jsp"><font size="5pc" color="#000000">个性动态</font></a><%}%><br/>
   <center>
       <%for(int i=0;vPost!=null&&i<vPost.size();i++){
	   Post p = (Post)vPost.get(i);%>
       <div class='tie1' align="left">
	      <br/><font face="宋体" size="3"><B>&nbsp;&nbsp;&nbsp;<a href="which-uni.jsp?num=<%=p.getSchoolId()%>&iPage=1"><%=p.getSchool_name()%>吧</a></B></font><br />
		  <font face="宋体" size="3" color="#3366FF"><B>&nbsp;&nbsp;&nbsp;     [<%=p.getTopic()%>]   <a href="/xiaonei1227/tiezi.jsp?post_Num=<%=p.getPost_num()%>"><%=p.getTheme()%></a></B></font><br />
          &nbsp;&nbsp;&nbsp;<%=p.getContent()%><br />  &nbsp;&nbsp;&nbsp;&nbsp;&nbsp;&nbsp;<%=p.getNick_name()%> &nbsp;&nbsp;&nbsp; &nbsp;&nbsp;&nbsp;<%=p.getTime()%>
	      <span style="position:absolute;right:240px;">赞数<font color="#ff0000"><%=p.getGoodnum()%></font></span>
	   </div>
	   <%}%>
   </center>
</div>
</center>
</div>
</body>
</html>
